<?php
/**
 * Created by PhpStorm
 * User: honglin
 * Date: 2022/8/3
 * Time: 下午6:04
 */

namespace App\Service\Login;

use App\Library\Login\LoginCode;
use App\Library\Login\LoginLibrary;
use App\Model\Admin\Admin;
use Hyperf\Di\Annotation\Inject;

class LoginService
{


    public function login($username,$password,$type='password'){
        $loginLibrary = LoginLibrary::init($username,$password,$type);
        $loginLibrary =  $loginLibrary->check();
        if($loginLibrary->code!==LoginCode::SUCCESS){
            _Error((LoginCode::getMessage($loginLibrary->code)));
        }
        return $loginLibrary->loginSuccess();
    }
}